package cn.cyh.queue_service.common;

/**
 * 返回结果状态码枚举类
 */
public enum ResultCode {
    /**
     * 成功
     */
    SUCCESS(200, "操作成功"),
    
    /**
     * 客户端错误
     */
    BAD_REQUEST(400, "请求参数有误"),
    UNAUTHORIZED(401, "未授权，请先登录"),
    FORBIDDEN(403, "无权限执行此操作"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不支持"),
    CONFLICT(409, "资源冲突"),
    
    /**
     * 业务错误
     */
    PARAM_ERROR(1001, "参数错误"),
    USER_EXIST(1002, "用户已存在"),
    USER_NOT_FOUND(1003, "用户不存在"),
    PASSWORD_ERROR(1004, "密码错误"),
    USER_DISABLED(1005, "用户已被禁用"),
    BUSINESS_TYPE_NOT_FOUND(1006, "业务类型不存在"),
    BUSINESS_TYPE_PREFIX_EXIST(1007, "业务类型前缀已存在"),
    BUSINESS_TYPE_DISABLED(1008, "业务类型已禁用"),
    WINDOW_NOT_FOUND(1009, "窗口不存在"),
    WINDOW_NUMBER_EXIST(1010, "窗口编号已存在"),
    FACE_FEATURE_REQUIRED(1011, "人脸特征数据不能为空"),
    FACE_VERIFY_FAILED(1012, "人脸验证失败"),
    WINDOW_MISMATCH(1013, "窗口不匹配"),
    TICKET_NOT_FOUND(1014, "票号不存在"),
    QUEUE_STATUS_ERROR(1015, "排队状态异常"),
    WINDOW_NOT_OPEN(1016, "窗口未开放"),
    WINDOW_HAS_CURRENT_NUMBER(1017, "窗口当前正在处理业务"),
    SERVICE_TYPE_NOT_SPECIFIED(1018, "未指定业务类型"),
    NO_WAITING_QUEUE(1019, "当前无等待队列"),
    
    /**
     * 外部服务错误
     */
    EXTERNAL_SERVICE_ERROR(4001, "外部服务调用异常"),
    EXTERNAL_SERVICE_TIMEOUT(4002, "外部服务调用超时"),
    EXTERNAL_SERVICE_UNAVAILABLE(4003, "外部服务不可用"),
    FACE_SERVICE_ERROR(4101, "人脸识别服务异常"),
    
    /**
     * 服务端错误
     */
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    
    /**
     * 通用错误
     */
    FAILED(1000, "操作失败"),
    VALIDATE_FAILED(1020, "参数校验失败"),
    
    /**
     * 缺失的业务错误码
     */
    NOTICE_NOT_FOUND(1030, "公告不存在"),
    PREFIX_EXISTS(1031, "前缀已存在"),
    BUSINESS_TYPE_IN_USE(1032, "业务类型正在使用中"),
    WINDOW_NUMBER_EXISTS(1033, "窗口编号已存在"),
    WINDOW_IN_USE(1034, "窗口正在使用中"),
    WINDOW_NOT_CLOSED(1035, "窗口未关闭"),
    FACE_NOT_VERIFIED(1036, "人脸验证未通过"),
    EXPORT_FAILED(1037, "导出失败"),
    USERNAME_EXISTS(1038, "用户名已存在");

    /**
     * 状态码
     */
    private final Integer code;
    
    /**
     * 消息
     */
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
} 